let obj = [
    {
        id: 1,
        name: "集团",
        children: [
            {
                id: 11,
                name: "成都分公司",
                children: [
                    {
                        id: 111,
                        name: "市场部门",
                    }
                ]
            }
        ]
    }
]

let newObj = []
function computeData(obj) {
    if (obj instanceof Array) {
        for (const item of obj) {
            newObj.push({ ...item, children: null })
            computeData(item.children)
        }
    }
}
computeData(obj)
console.log(newObj);

